#include "stdafx.h"
#include "FactoryGenerator.h"

#include "Factory\DiamondSquareFactory.h"
#include "Factory\FaultFactory.h"
#include "Factory\NormalizeFactory.h"
#include "Factory\RandomNoiseFactory.h"
#include "Factory\SmoothFactory.h"
#include "Factory\VoronoiFactory.h"
#include "../../Framework/Toolkit.h"

using namespace Framework;

namespace MyGame {

FactoryGenerator::FactoryGenerator(void) {
}

FactoryGenerator::~FactoryGenerator(void) {
}

std::vector<Factory*> FactoryGenerator::Generate(int seed) const {
    std::vector<Factory*> factories;
    srand(seed);
    int n = Toolkit::RandomInt(3, 10);

    for (int i = 0; i < n; ++i) {
        Factory* factory;
        switch (rand() % 5) {
        case 0:
            factory = new DiamondSquareFactory();
            break;
        case 1:
            factory = new FaultFactory();
            break;
        case 2:
            factory = new RandomNoiseFactory();
            break;
        case 3:
            factory = new SmoothFactory();
            break;
        case 4:
            factory = new VoronoiFactory();
            break;
        }

        factories.push_back(factory);
    }

    return factories;
}

}
